package com.lkd.feign.fallback;
import com.lkd.feign.OrderService;
import com.lkd.vo.PayVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lenovo
 */
@Component
@Slf4j
public class OrderServiceFallbackFactory implements FallbackFactory<OrderService> {

    @Override
    public OrderService create(Throwable throwable) {
        return new OrderService(){

            @Override
            public Map<String, String> weiXinPay(PayVO payVO) {
                Map<String, String> resultMap = new HashMap<>(10);
                resultMap.put("code", "RETURN_FAIL");
                resultMap.put("msg", "当前网络忙,请重试");
                return resultMap;
            }
        };
    }
}
